Elisp Functions

Table of Contents

1. Define Functions

Basic function definition has the form

  (defun function_name (param1 param2 etc)
    "docstring"
    body)

When a function is called, the last expression in the function’s body is returned.

1.1. Optional Parameters

Add &optional

1.2. Rest Parameters

Add &rest, becomes a list.

2. Lambda Functions

3. Higher-Order Functions

3.1. apply

  (apply FUNCTION &rest args_or_list)

Useful when we have a list and want to feed them as function parameters.

3.2. funcall

  (funcall FUNCTION &rest args)

Useful when function name is a variable, whose value is known only at runtime.

3.3. identity

  (identity ARGUMENT)

Simply returns the ARGUMENT.

3.4. ignore

  (ignore &rest ARGUMENTS)

Ignore ARGUMENTS, and return nil

3.5. always

  (always &rest ARGUMENTS)

Ignore ARGUMENTS, do nothing and return t.

4. Function Types


5. Docstring Markup

Date: 2026-07-22 Wed